# coding=utf-8

from django.contrib import admin
from brand.models import Brand, BrandTag


class BrandAdmin(admin.ModelAdmin):
    list_display = ('show_name', 'id', 'brand_name_zh', 'brand_name_en', 'create_time')
    search_fields = ('brand_name_en', 'brand_name_zh', 'show_name')
    list_filter = ('create_time', 'show_name')
    date_hierarchy = 'create_time'
    filter_horizontal = ('brand_tags',)
    # raw_id_fields = ('')      # 处理外键字段


class BrandTagAdmin(admin.ModelAdmin):
    list_display = ('tag_name', 'id')
    search_fields = ('tag_name',)


# Register your models here.
admin.site.register(Brand, BrandAdmin)
admin.site.register(BrandTag, BrandTagAdmin)
